<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
    //就是http://127.0.0.1:8080/pic/
    String basePath = "http://106.53.67.228/";
%>
<!doctype html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>小说网</title>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/static/css/index.css">
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/static/css/news.css">
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/static/css/iconfont.css">
    <style>
        .icon {

            width: 1em; height: 1em;

            vertical-align: -0.15em;

            fill: currentColor;

            overflow: hidden;

        }
    </style>
<body>
<div id="topOne">
    <div class="nav-link">
        <a class="act" href="${pageContext.request.contextPath}/index" >畅读中文网</a><%--<em>|</em>--%>
        <div class="user">
            <font class="iconfont">
                <c:choose>
                    <c:when test="${user ne null }">
                        欢迎 ${user.username }
                        <c:if test="${userVip eq 0}">&#xe72f;</c:if>
                        <c:if test="${userVip eq 1}"> <svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-huiyuanjulebu1"></use>
                        </svg></c:if>
                    </c:when>
                    <c:otherwise><a href="${pageContext.request.contextPath}/loginAndRegist.jsp">登录</a></c:otherwise>
                </c:choose>
            </font>
            |
            <font class="iconfont">
                <c:choose>
                    <c:when test="${user ne null }"><a href="<c:url value="/user/logout"/>">退出</a></c:when>
                    <c:otherwise><a href="${pageContext.request.contextPath}/loginAndRegist.jsp">注册</a></c:otherwise>
                </c:choose>
            </font>
        </div>
    </div>
</div>
<div id="Top">
    <div class="logo">
        <a href="${pageContext.request.contextPath}/index">
            <img src="${pageContext.request.contextPath}/static/images/logoA.png" width="100px" height="50px" />
        </a>
    </div>
    <div class="search">
        <form   id="search" action="<c:url value="/novel/findNovel" />" method="post">
            <div id="searchTxt" class="searchTxt">

                <div class="searchMenu">

                    <ul>
                        <select  id="sel" name="novel.typeId" style="height:39px;border:0;padding:2px;margin:0;">
                            <option value="">--请选择--</option>
                            <c:forEach items="${noveltypeList }" var="noveltype">
                                <option  style="background-color:transparent;"  value="${noveltype.id }">
                                        ${noveltype.typename }
                                </option>
                            </c:forEach>
                        </select>

                    </ul>

                </div>

                <input name="novel.novelname" type="text" />
                <div class="searchBtn">
                    <button id="searchBtn"></button>
                </div>
            </div>

        </form>
    </div>
</div>
<input   type="hidden" id="news" value="${newsRes.linkurl}">
<div id="myTXT" >
    <header><h3>${newsRes.title}</h3></header>
    <main>

    </main>
    <%--<main><object type="text/x-scriptlet" style="font-size: 50px;" data="<%=basePath%>${newsRes.linkurl}" width=100% height=100%></object></main>--%>
<%--    <iframe    name="iframe1" onload="this.height=this.contentWindow.document.body.scrollHeight" frameborder="0" width="100%" src="<%=basePath%>${newsRes.linkurl}"></iframe>--%>
</div>

<div class="Footer">
    <div class="footer_nav">
        <a>关于畅读小说网</a>&#12288;|&#12288;
        <a>商务合作</a>&#12288;|&#12288;
        <a>友情链接</a>&#12288;|&#12288;
        <a>帮助中心</a>&#12288;|&#12288;
        <a>用户守则</a>&#12288;|&#12288;
        <a>网站地图</a>&#12288;|&#12288;
        <a>诚聘精英</a>&#12288;|&#12288;
        <a>畅读</a>
    </div>
    <p>
        <a>Copyright (C) 2018-2019 www.changdu.com All Rights Reserved </a>
        <br />--畅读权利声明。
    </p>
</div>
</body>
<!--引用外部jquery文件-->
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/index.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/iconfont.js"></script>
<script type="text/javascript">
    var newsRes = $("#news").val();
    var ajaxDate;
    $.ajax({
        url:"<%=basePath%>"+newsRes,
        type:"get",
        /*  cache :false,
          jsonp: "callback",
          jsonpCallback:"success",*/
        dataType : 'text',
        success:function(data){
            ajaxDate=data;
            data = data.replace(/(\r)*\n/g,"<br/>").replace(/\s/g,"&nbsp;").replace(/(<br\s?\/?>)+/gi, '<br>&nbsp;&nbsp;');
            $("main").html(" &nbsp;&nbsp;"+data);
            console.log(data);
        },
        error:function(data){
            alert("请求失败！！");
        }

    });


    // //提交
    // $(function() {
    //     $("#searchBtn").click(function () {
    //         $("#search").submit();
    //     });
    // });

</script>
</html>